package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.UserCouponRequest;
import one.stand.response.UserCouponResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: QIK
 * @CreateDate: 2019/6/24 17:40
 */
@RestController
@RequestMapping("userApi/user/coupon")
@Api(description = "用户优惠券")
public class UserCouponController extends BaseController {

    /**
     * 领取优惠券
     * @param request
     * @return
     */
    @ApiOperation(value = "领取优惠券")
    @PostMapping("receive")
    @ApiController(isLogin = true,paramClass = UserCouponRequest.class)
    public ResultModel<Boolean> receive(@RequestAttribute UserCouponRequest request){
        return userFegin.receive(request);
    }

    /**
     * 用户自己的优惠券列表
     * @param request
     * @return
     */
    @ApiOperation(value = "个人优惠券列表")
    @PostMapping("myList")
    @ApiController(isLogin = true,paramClass = UserCouponRequest.class)
    public ResultModel<List<UserCouponResponse>> myList(@RequestAttribute UserCouponRequest request){
        return userFegin.myList(request);
    }
    /**
     * 用户自己的优惠券列表
     * @param request
     * @return
     */
    @ApiOperation(value = "个人优惠券列表")
    @PostMapping("noReceive")
    @ApiController(isLogin = true,paramClass = UserCouponRequest.class)
    public ResultModel<List<UserCouponResponse>> noReceive(@RequestAttribute UserCouponRequest request){
        return userFegin.noReceive(request);
    }
}
